﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GmaWebService.Interfaces;
using MPWebStream.MediaTranscoding;

namespace GmaWebService.Code
{
    public static class WebFileInfoExtensionMethods
    {
        public static WebPicture ToWebPicture(this WebFileInfo info)
        {
            if (info == null)
                return null;
            return MPPictures.readFile(info.FullName);
        }
    }

    public static class FFmpegEncodingInfoExtensionMethods
    {
        public static WebTranscodingInfo ToWebTranscodingInfo(this FFmpegEncodingInfo info)
        {
            if (info != null)
            {
                return new WebTranscodingInfo()
            {
                CurrentBitrate = info.CurrentBitrate,
                CurrentTime = info.CurrentTime,
                EncodedFrames = info.EncodedFrames,
                EncodingFPS = info.EncodingFPS
            };
            }
            else
            {
                return new WebTranscodingInfo();
            }
        }
    }
}
